<template>
<div class="header">
  <div class="header-left"><div class="iconfont back-icon">&#xe624;</div></div>
  <div class="header-input">
    <i class="iconfont">&#xe632;</i>
    <input type="text" placeholder="输入城市/景点/游玩主题" />
  </div>
  <router-link to="/city">
    <div class="header-right">{{this.city}} <i class="iconfont arrow-icon">&#xe64a;</i></div>
  </router-link>
</div>
</template>

<script>
import { mapState, mapGetters } from 'vuex'
export default {
  name: 'HomeHeader',
  computed: {
    // 展开运行符 mapState是指把vuex里的数据映射到这个组件的computed计算属性里
    // 把city这个公用数据映射到名字叫做city的计算属性之中
    ...mapState(['city']),
    ...mapGetters(['doubleCity'])
  }
}
</script>

<style lang="stylus" scoped>
@import '~styles/varibles.styl'
.header
  display:flex
  line-height: $headerHeight
  background: $bgColor
  color #fff
  .header-left
    width: .64rem
    float:left
    .back-icon
      text-align: center
      font-size:.4rem
  .header-input
    flex: 1
    margin: .12rem 0 .12rem .2rem
    padding-left:.2rem
    height: .62rem
    line-height: .62rem
    color: #ccc
    background: #fff
    border-radius: .1rem
    input
      width: 90%
      margin-bottom :.08rem
  .header-right
    padding:0 .1rem
    min-width: 1.04rem
    float:right
    text-align: center
    color: #fff
    .arrow-icon
      margin-left: -.04rem
      font-size: .24rem
</style>
